package load.education;

import core.DispatcherPort;
import core.InPort;
import core.StdNode;
import core.TriggerPort;

/**
 *
 * @author Ben
 */
public class Turn extends StdNode{
    private DispatcherPort done = new DispatcherPort();
    private InPort degrees = new InPort(Integer.class);

    private TriggerPort left = new TriggerPort() {
            @Override
            public void callInternal() {
                controller.StdDraw.getInstance().getTurtle().turn((Integer)degrees.getValue(),true);
                done.callTargets();
            }
    };

    private TriggerPort right = new TriggerPort() {
            @Override
            public void callInternal() {
                controller.StdDraw.getInstance().getTurtle().turn((Integer)degrees.getValue(),false);
                done.callTargets();
            }
    };

    public Turn() {
        this.autoPutPorts();
    }
    
}
